#pragma once
#ifndef OBR_CONFIGURABLE_H
#define OBR_CONFIGURABLE_H

#include "common.h"
#include "helpers/Config/ConfigHelpers.h"

namespace OBR
{
class Scene;

/**
 * @brief base class of every configurable class
 *
 */
template <class T> class Configurable
{
public:
    /**
     * @brief config class using given json configuration
     *
     * @param config
     */
    void buildFromConfig(const Json::Value &config)
    {
        this->_buildFromConfig(config);
        this->_onBuildEnd();
    }

    virtual void postBuild(Scene &scene)
    {
    }
protected:
    /**
     * @brief config class using given json configuration
     *
     * @param config
     */
    virtual void _buildFromConfig(const Json::Value &config) = 0;

    virtual void _onBuildEnd()
    {
    }
};
} // namespace OBR

#endif // OBR_BASE_H
